const path = require("path")
module.exports = {
  outputDir: "dist",
  assetsDir: "static",
  publicPath: "./",
  devServer: {
    proxy: {
      [process.env.VUE_APP_BASE_API]: {
        target: process.env.PROXY_TARGET,
        changeOrigin: true,
        pathRewrite: {
          ["^" + process.env.VUE_APP_BASE_API]: ""
        }
      }
    }
  },
  chainWebpack: config => {
    const types = ["vue-modules", "vue", "normal-modules", "normal"]
    types.forEach(type =>
      addStyleResource(config.module.rule("scss").oneOf(type))
    )
  }
}
function addStyleResource(rule) {
  rule
    .use("style-resource")
    .loader("style-resources-loader")
    .options({
      patterns: [path.resolve(__dirname, "./src/scss/index.scss")]
    })
}
